package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import light.head.constant.Sys;

import org.hibernate.annotations.Formula;

/**
 * 车辆申请
 */
@Entity
@Table
public class VehicleApply implements Serializable {
	

	private static final long serialVersionUID = -5530944583092344768L;
	
	
	private Integer code;
	private String title;						// 标题
	private Integer cu;							// 申请人编号
	private Date ct = new Date();				// 申请时间
	private Integer oc;							// 创建机构
	private Byte status;						// 使用状况（1.未使用2.使用中3 已归还）
	private Boolean designate = false;			// 是否指派
	private Byte verify = Sys.B_ONE;			// 审核状态(1.审核中 2.通过 3.未通过）
	private Boolean deleted = false;
	private String remark;
	
	private String on;							// 创建机构名称
	private String cn;							// 申请人名称
	private List<VehicleApplyItem> adList;		// 申请明细
	private List<AuditStatus> auditStatusList;	// 审核状态
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Boolean getDesignate() {
		return designate;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public String getTitle() {
		return title;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Byte getStatus() {
		return status;
	}
	@Column
	public Byte getVerify() {
		return verify;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Transient
	public List<VehicleApplyItem> getAdList() {
		return adList;
	}
	@Transient
	public List<AuditStatus> getAuditStatusList() {
		return auditStatusList;
	}
	
	
	
	

	
	public void setVerify(Byte verify) {
		this.verify = verify;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setAdList(List<VehicleApplyItem> adList) {
		this.adList = adList;
	}
	public void setAuditStatusList(List<AuditStatus> auditStatusList) {
		this.auditStatusList = auditStatusList;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setDesignate(Boolean designate) {
		this.designate = designate;
	}
	

	public void setStatus(Byte status) {
		this.status = status;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	

}
